import React, { Component } from 'react';

import All from "../view/All"
import Index from "../view/Index"
import List from "../view/List"
import My from "../view/My"
import Shop from "../view/Shop"
import No from "../view/No"

//引用route
import { Route, Switch, Redirect } from "react-router-dom"
class index extends Component {
    render() {
        return (
            <>
                {/* 唯一渲染 */}
                <Switch>

                    <Route path="/index" component={Index} />
                    <Route path="/list" component={List} />
                    <Route path="/all" component={All} />
                    <Route path="/shop" component={Shop} />
                    <Route path="/my" component={My} />

                    {/* redirect重定向 */}
                    {/* 精准匹配 exact */}
                    <Redirect from='/' to="/index" exact/>


                    {/* 404页面 */}
                    <Route component={No} />
                </Switch>
            </>
        );
    }
}

export default index;